<template>
<keep-alive>
  <el-container class="home_container">
    <!--头部栏-->
    <el-header>
      <div>
        <span>测试</span>
      </div>
      <el-button type="primary" @click="logout">注销</el-button>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu router background-color="#545c64" text-color="#fff" active-text-color="#ffd04b">
          <!--主页-->
          <el-menu-item index="/home/user">
            <i class="el-icon-setting"></i>
            <span slot="title">个人中心</span>
          </el-menu-item>
          <!--权限管理-->
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>权限管理</span>
            </template>
            <el-menu-item index="/home/accessGet">获得权限</el-menu-item>
            <el-menu-item index="/home/accessGive">给出权限</el-menu-item>
          </el-submenu>
          <!--消息管理-->
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-s-promotion"></i>
              <span slot="title">消息管理</span>
            </template>
            <el-menu-item index="/home/msgGet">收到的</el-menu-item>
            <el-menu-item index="/home/msgGive">发送的</el-menu-item>
          </el-submenu>
          <!--文件管理-->
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-document"></i>
              <span slot="title">文件管理</span>
            </template>
            <el-menu-item index="/home/files">获取文件</el-menu-item>
            <el-menu-item index="/home/myfiles">我的文件</el-menu-item>
          </el-submenu>
          <!--待定-->
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span slot="title">导航四</span>
            </template>
            <el-menu-item index="4-1">选项1</el-menu-item>
            <el-menu-item index="4-2">选项2</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <!--主页-->
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</keep-alive>
</template>
<script>
export default {
  data() {
    return {};
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    getInfo() {
      this.$axios.post("home").then(res => {
        this.$message({
          message: res.data
        });
      });
    },
    logout(){
      this.$router.push('/login')
      window.localStorage.removeItem('token')
    }
  }
};
</script>
<style lang="less" scoped>
.home_container {
  height: 100%;
}
.el-header {
  background-color: #373d41;
  display: flex;
  justify-content: space-between;
  color: #ffffff;
  font-size: 20px;
  align-items: center;
  > div {
    display: flex;  
    align-items: center;
  }
}
.el-aside {
  background-color: #333744;
}
.el-main {
  background-color: #eaedf1;
}
</style>